package test;

import lejos.nxt.*;
import lejos.nxt.addon.RCXLightSensor;

public class LightSensorL 
{
	
	static int ball = 40;
	
	static RCXLightSensor light1 = new RCXLightSensor(SensorPort.S1);
	static LightSensor light2 = new LightSensor(SensorPort.S3, true);

   public static void main(String [] args)  
   throws Exception 
   {
	   
	   while (! Button.ESCAPE.isPressed()){
			LCD.clear();
		   
			MotorPort.C.controlMotor(100, 1);
			if(light1.getLightValue() < ball || light2.readNormalizedValue() < ball){ //we have seen the ball
				//send signal til pc
				LCD.drawString("We have seen the ball", 0, 2);
				
			}
			
			LCD.drawInt(light1.getLightValue(), 0, 0);
		//	LCD.drawInt(light1.readNormalizedValue(), 0, 5);
	        Thread.sleep(30);
	   }
	   LCD.clear();
       LCD.drawString("Program stopped", 0, 0);
       Thread.sleep(2000);
	   
   }
}